<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Helper;
use App\Models\Server;
use App\Models\Account;

class UserMoneyLog extends Model
{
    protected $table = "user_money_logs";

    protected $guarded = [];

    public function getPlayerData()
    {
        $server = Server::find($this->server_id);
        if (!$server) return null;
        Helper::setDataBaseConf('mysql_auth',$server,'acore_auth');
        $player = Account::find($this->player_id);
        return $player;
    }

    public function getServerData()
    {
        return $this->belongsTo('App\Models\Server','server_id','id');
    }
}
